<include file="Public/header"/>
<body>
<header>
<div class="tab_nav">
  <div class="header">
    <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
    <div class="h-mid"><img src="__STATIC__/images/toplogo.png">信息修改</div>
    <div class="h-right">
      <aside class="top_bar">
        <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a href="javascript:;"></a> </div>
      </aside>
    </div>
  </div>
</div>
</header>
<include file="Public/menu"/>
<div id="tbh5v0">	
<div class="Personal">
  <div id="tbh5v0">
    <div class="innercontent1" >
      <form method="post" action="" id="edit_profile"  onSubmit="return checkinfo()">
        <div class="name"><span>昵　 称</span>
          <input type="text" name="nickname" id="nickname" value="{$user.nickname}" placeholder="*昵称" class="c-f-text">
        </div>
      
        <div class="name1"> <span>性　 别</span>
          <ul>
            <li  <?php if($user['sex']==0) {echo 'class="on"';} ?>   >
              <label for="sex0">
               <input type="radio" name="sex" value="0" tabindex="2"  class="radio" id="sex0" <?php if($user['sex']==0) {echo 'checked="checked"';} ?>>
               	 保密</label>
            </li>
            <li  <?php if($user['sex']==1) {echo 'class="on"';} ?> >
              <label for="sex1">
                <input type="radio" name="sex" value="1" tabindex="3" class="radio" id="sex1" <?php if($user['sex']==1) {echo 'checked="checked"';} ?> >
                	男</label>
            </li>
            <li  <?php if($user['sex']==2) {echo 'class="on"';} ?> >
              <label for="sex2">
                <input type="radio" name="sex" value="2" tabindex="4" class="radio" id="sex2" <?php if($user['sex']==2) {echo 'checked="checked"';} ?>>
                	女</label>
            </li>
          </ul>
        </div>        
         
        <div class="name">
          <label for="email_ep"> <span>邮箱</span>
            <input name="email" value="{$user.email}" id="email_ep" placeholder="*电子邮件地址" type="text" />
          </label>
        </div>
        <div class="name">
          <label for="email_ep"> <span>手机</span>
            <input name="mobile" value="{$user.mobile}" id="mobile_ep" placeholder="*手机号码" type="text" />
          </label>
        </div>   
        <div class="name">
          <label for="email_ep"> <span>开户银行</span>
            <input name="bank_opening" value="{$user.bank_opening}" id="bank_opening" placeholder="开户银行" type="text" />
          </label>
        </div>      
        <div class="name">
          <label for="email_ep"> <span>分行支行</span>
            <input name="bank_address" value="{$user.bank_address}" id="bank_address" placeholder="分行支行" type="text" />
          </label>
        </div> 
        <div class="name">
          <label for="email_ep"> <span>开户姓名</span>
            <input name="bank_name" value="{$user.bank_name}" id="bank_name" placeholder="开户姓名" type="text" />
          </label>
        </div> 
        <div class="name">
          <label for="email_ep"> <span>银行账号</span>
            <input name="bank_account" value="{$user.bank_account}" id="bank_account" placeholder="银行账号" type="text" />
          </label>
        </div>
        <div class="name">
          <label for="email_ep"> <span>身份证号</span>
            <input name="card" value="{$user.card}" id="card" placeholder="身份证号：" type="text" />
          </label>
        </div>
        <div class="name">
          <label for="email_ep"> <span>支付宝号</span>
            <input name="zfb" value="{$user.zfb}" id="zfb" placeholder="支付宝号：" type="text" />
          </label>
        </div>
        <div class="field submit-btn">
          <input type="submit" value="确认修改" class="btn_big1" />
        </div>
      </form>
    </div>

    <div class="innercontent11" >
      <form name="formPassword" action="{:U('User/password')}" method="post" onSubmit="return editPassword()">
        <h4 class="title">密码修改</h4>
        <div class="field_pwd">
          <label for="password">
            <input type="password" name="old_password" id="password" class="c-f-text" placeholder="原密码" value=""/>
          </label>
        </div>
        <div class="field_pwd">
          <label for="new_password">
            <input type="password" name="new_password" id="new_password" class="c-f-text" placeholder="新密码"/>
          </label>
        </div>
        <div class="field_pwd">
          <label for="comfirm_password"> 
            <input type="password" name="confirm_password" id="comfirm_password" class="c-f-text" placeholder="确认密码"/>
          </label>
        </div>
        <div class="field submit-btn">
          <input type="submit" value="确认修改" class="btn_big1" />
        </div>
      </form>
    </div>

    <div class="innercontent11" >
      <form name="formsecpwd" action="{:U('User/secpwd')}" method="post" onSubmit="return editsecpwd()">
        <h4 class="title">交易密码修改</h4>
        <div class="field_pwd">
          <label for="password">
            <input type="password" name="old_password" id="secpwd" class="c-f-text" placeholder="原交易密码" value=""/>
          </label>
        </div>
        <div class="field_pwd">
          <label for="new_password">
            <input type="password" name="new_password" id="new_secpwd" class="c-f-text" placeholder="新交易密码"/>
          </label>
        </div>
        <div class="field_pwd">
          <label for="comfirm_password"> 
            <input type="password" name="confirm_password" id="confirm_secpwd" class="c-f-text" placeholder="确认交易密码"/>
          </label>
        </div>
        <div class="field submit-btn">
          <input type="submit" value="确认修改" class="btn_big1" />
        </div>
      </form>
    </div>
  </div>
</div>

<script>
    $('.name1 ul li').click(function(){
		$(this).find("input").attr("checked","checked");
	$('.name1 ul li').removeClass("on");
		$(this).addClass("on");
	})
</script>								
</div>

<script language="javascript">
$(function(){ 
	$('input[type=text],input[type=password]').bind({ 
		focus:function(){ 
		 $(".global-nav").css("display",'none'); 
		}, 
		blur:function(){ 
		 $(".global-nav").css("display",'flex'); 
		} 
	}); 
}) 

var email_empty = "请输入您的电子邮件地址！";
var email_error = "您输入的电子邮件地址格式不正确！";
var old_password_empty = "请输入您的原密码！";
var new_password_empty = "请输入6位以上新密码！";
var confirm_password_empty = "请输入6位以上确认密码！";
var both_password_error = "您现两次输入的密码不一致！";
/* 会员修改密码 */
function editPassword() {
	var frm = document.forms['formPassword'];
	var old_password = frm.elements['old_password'].value;
	var new_password = frm.elements['new_password'].value;
	var confirm_password = frm.elements['comfirm_password'].value;

	var msg = '';
	var reg = null;

	if (old_password.length == 0) {
		msg += old_password_empty + '\n';
	}

	if (new_password.length < 6) {
		msg += new_password_empty + '\n';
	}

	if (confirm_password.length < 6) {
		msg += confirm_password_empty + '\n';
	}

	if (new_password.length > 0 && confirm_password.length > 0) {
		if (new_password != confirm_password) {
			msg += both_password_error + '\n';
		}
	}

	if (msg.length > 0) {
		alert(msg);
		return false;
	} else {
		return true;
	}
}


function editsecpwd() {
  var frm = document.forms['formsecpwd'];
  var old_password = frm.elements['old_password'].value;
  var new_password = frm.elements['new_password'].value;
  var confirm_password = frm.elements['comfirm_password'].value;
  var msg = '';
  var reg = null;

  if (old_password.length == 0) {
    msg += old_password_empty + '\n';
  }

  if (new_password.length < 6) {
    msg += new_password_empty + '\n';
  }

  if (confirm_password.length < 6) {
    msg += confirm_password_empty + '\n';
  }

  if (new_password.length > 0 && confirm_password.length > 0) {
    if (new_password != confirm_password) {
      msg += both_password_error + '\n';
    }
  }

  if (msg.length > 0) {
    alert(msg);
    return false;
  } else {
    return true;
  }
}




function checkinfo(){
	var nickname = $('#nickname').val();
	var email = $('#email_ep').val();
  var mobile = $('#mobile_ep').val(); 
  var bank_opening = $('#bank_opening').val(); 
  var bank_address = $('#bank_address').val(); 
  var bank_name = $('#bank_name').val(); 
  var bank_account = $('#bank_account').val();  
  var card = $('#card').val();  
	//var bank_account = $('#bank_account').val();	
	if(nickname==''){
		alert("昵称不能为空");
		return false;
	}
	
	if(!checkEmail(email)){
		alert("邮箱格式不正确");
		return false;
	}
	
	if(!checkMobile(mobile)){
		alert("手机格式不正确");
		return false;
	}	

  if(bank_opening==''){
    alert("开户行不能为空");
    return false;
  }

  if(bank_address==''){
    alert("分行支行不能为空");
    return false;
  }
  if(bank_name==''){
    alert("开户姓名不能为空");
    return false;
  }
  if(bank_account==''){
    alert("开户行账号不能为空");
    return false;
  }
  if(card==''){
    alert("身份证号不能为空");
    return false;
  }
	return true;
}
</script>
</body>
</html>